# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Roman Kyrylych <roman@archlinux.org>
# Contributor: Tom Killian <tomk@runbox.com>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=libnewt
pkgver=0.52.23
pkgrel=2
_tclver=8.6
pkgdesc="Not Erik's Windowing Toolkit - text mode windowing with slang"
arch=(loong64 x86_64)
url='https://pagure.io/newt'
license=(GPL)
depends=(gpm popt slang)
makedepends=(python "tcl>=$_tclver")
optdepends=('python: libnewt support with the _snack module'
            'tcl: whiptcl support')
options=(!makeflags)
source=("https://releases.pagure.org/newt/newt-$pkgver.tar.gz")
b2sums=('55046155d02a406ac618f9c1a1f668e6794b6875e4d9083e3d5da32fe008df3deb79eddadfce40c193346b7a705b8c5c18e7bb7076e8ea8729f35384fa944a97')

prepare() {
  cd newt-$pkgver
  echo '#define USE_INTERP_RESULT 1' >> config.h
  sed -i "s:tcl8.4:tcl$_tclver:" Makefile.in
}

build() {
  cd newt-$pkgver
  ./configure --prefix=/usr --with-gpm-support
  make
}

package() {
  make -C newt-$pkgver prefix="$pkgdir/usr" install
}
